<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>增加缴费信息</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<link rel="stylesheet" href="../css/font.css">
		<link rel="stylesheet" href="../css/xadmin.css">
		<script type="text/javascript" src="../assets/js/jquery-1.8.3.min.js"></script>
		<script src="../lib/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="../js/xadmin.js"></script>
    </head>
    <body>
        <div class="layui-fluid" style="width: 600px;margin-top: 30px;">
            <div class="layui-row">
                <div class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>姓名
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="oname"  lay-verify="required"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                  <div class="layui-form-item">
                      <label for="phone" class="layui-form-label">
                          <span class="x-red">*</span>电话
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="ophone" maxlength="11"
                          autocomplete="off" class="layui-input">
                      </div>
                      <div class="layui-form-mid layui-word-aux">
                          <span class="x-red">*</span>
                      </div>
                  </div>
				  <div class="layui-form-item">
				      <label for="phone" class="layui-form-label">
				          <span class="x-red">*</span>目的
				      </label>
				      <div class="layui-input-inline">
				          <input type="text" id="oobjective"
				          autocomplete="off" class="layui-input">
				      </div>
				      <div class="layui-form-mid layui-word-aux">
				          <span class="x-red">*</span>
				      </div>
					  
				  </div>
				  <div class="layui-form-item">
				      <label for="phone" class="layui-form-label">
				          <span class="x-red">*</span>身份证号
				      </label>
				      <div class="layui-input-inline">
				          <input type="text" id="onumberId" maxlength="18" 				          autocomplete="off" class="layui-input">
				      </div>
				      <div class="layui-form-mid layui-word-aux">
				          <span class="x-red">*</span>
				      </div>
				  					  
				  </div>
				  <div class="layui-form-item">
				      <label for="phone" class="layui-form-label">
				          <span class="x-red">*</span>车牌号
				      </label>
				      <div class="layui-input-inline">
				          <input type="text" id="olicensePlate"
				          autocomplete="off" class="layui-input">
				      </div>
				  					  
				  </div>
                  
                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" lay-filter="add" id="butt" lay-submit="">
                          增加
                      </button>
					  <button style="margin-left: 90px;"  class="layui-btn" lay-filter="add" lay-submit="">
					      清空
					  </button>
                  </div>
              </div>
            </div>
        </div>
    </body>
</html>
<script>
	layui.use(['table', 'jquery','layer'], function () {
		var table = layui.table;
		var $ = layui.jquery;
		var layer=layui.layer;

		$("#butt").click(function () {
			let oname = $("#oname").val();
			let ophone = $("#ophone").val();
			let oobjective = $("#oobjective").val();
			let onumberId = $("#onumberId").val();
			let olicensePlate = $("#olicensePlate").val();
			let flag = true;
			if (oname == "" || ophone == ""  || oobjective == "" ||onumberId =="" || olicensePlate=="") {
				layer.msg('便民电话信息填写完整!', {
					icon: 2, time: 800
				});
				flag = false;
			}

			if (flag) {
				$.ajax({
					type:'POST',
					url: "http://localhost:8080/api/djwlry",
					data: {
						"oName": oname,
						"oPhone": ophone,
						"oObjective": oobjective,
						"oNumberId": onumberId,
						"oLicensePlate": olicensePlate
					},
					headers: {
						token: localStorage.getItem("token")
					},
					datatype: "json",
					success: function (data) {
						if(data!="") {
							var index = parent.layer.getFrameIndex(window.name);
							layer.msg('增加成功!',{
								icon:1
								,time:1000
							},function (){
								parent.layer.close(index);//关闭当前页
							});
						}
					}
				})

			}
		})
	})

</script>
